import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'zone.js'
import { registerMicroApps, start } from 'qiankun'
import './util/actions'

Vue.config.productionTip = false

async function getMicroApps () {
  return [
    {
      name: 'reactApp',
      entry: process.env.VUE_APP_REACT_ENTRY,
      container: '#container',
      activeRule: '/react-app'
    },
    {
      name: 'vueApp',
      entry: process.env.VUE_APP_VUE2_ENTRY,
      container: '#container',
      activeRule: '/vue-app'
    }
    // {
    //   name: 'angular',
    //   entry: process.env.VUE_APP_ANGULAR_ENTRY,
    //   container: '#container',
    //   activeRule: '/angular'
    // },
    // {
    //   name: 'jquery',
    //   entry: process.env.VUE_APP_PUREHTML_ENTRY,
    //   container: '#container',
    //   activeRule: '/jquery'
    // },
    // {
    //   name: 'VUE-APP2',
    //   entry: process.env.VUE_APP_VUE_APP2,
    //   container: '#container',
    //   activeRule: '/vue-app2'
    // }
  ]
}
async function initMicroApp () {
  const microApps = await getMicroApps()
  registerMicroApps(microApps)
  start()
}
initMicroApp()
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
